import requests

from common.get_token import get_token

class EmpManage(object):
    # 增加员工
    @staticmethod
    def add_emp(token,request_data):
        resp = requests.post("http://ihrm-test.itheima.net/api/sys/user",
                      headers = {"Authorization":token},
                      json = request_data)
        return resp
    # 修改员工
    @staticmethod
    def dul_emp(token,request_data,id):
        resp = requests.post("http://ihrm-test.itheima.net/api/sys/user"+id,
                      headers = {"Authorization":token},
                      json = request_data)
        return resp
    # 删除员工
    @staticmethod
    def del_emp(token,id):
        resp = requests.post("http://ihrm-test.itheima.net/api/sys/user" + id,
                             headers={"Authorization": token})
        return resp
if __name__ == '__main__':

    token = get_token()
    add_data = {"username": "asdb", "mobile": "15139978451", "workNumber": "123412412412"}
    resp = EmpManage.add_emp(token,add_data)
    print(resp.json())